<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Add Relation</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container mt-4">
    <h1>Add Relation to <span th:text="${sourceName}"></span></h1>

    <form th:action="@{/knowledge-graph/relation}" method="post">
        <input type="hidden" name="sourceName" th:value="${sourceName}">

        <div class="mb-3">
            <label for="targetName" class="form-label">Target Entity Name</label>
            <input type="text" class="form-control" id="targetName" name="targetName" required>
        </div>

        <div class="mb-3">
            <label for="type" class="form-label">Relation Type</label>
            <input type="text" class="form-control" id="type" name="type" required>
        </div>

        <div class="mb-3">
            <label for="description" class="form-label">Description</label>
            <textarea class="form-control" id="description" name="description" rows="3"></textarea>
        </div>

        <button type="submit" class="btn btn-primary">Add Relation</button>
        <a th:href="@{/knowledge-graph/entity/{name}(name=${sourceName})}"
           class="btn btn-secondary">Cancel</a>
    </form>
</div>
</body>
</html>